package com.neutech.maplestory.entity;

import com.neutech.maplestory.util.ImageUtil;

import java.awt.*;

/**
 * @author 小李要吃鱼
 * @date 2021-01-28 17:33
 */
public class Arrow extends AbstractMapleStoryObject{
    public static Image[] imgs = {
            ImageUtil.getImages("arrow/right/arrow"),
            ImageUtil.getImages("arrow/left/arrow"),
    };

    public Arrow(){
        this.speed = 20;
    }

    public  Arrow(int x, int y,Direction dir){
        this();
        this.x = x;
        this.y = y;
        this.dir = dir;
//        if (dir == Direction.RIGHT){
//            this.img = imgs[0];
//        }else{this.img = imgs[1];
//        }

    }

    @Override
    public void draw(Graphics g) {
        switch (dir){
        case RIGHT:
            g.drawImage(imgs[0],x,y,null);
            break;
            case LEFT:
                g.drawImage(imgs[1],x,y,null);
            default:
                break;
        }
        move();

    }

    @Override
    public void move() {
        switch (dir){
            case RIGHT:
                this.x -= speed;
                break;
            case LEFT:
                this.x += speed;
                default:
                break;
        }

    }
}
